﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：YS_LH_LAIHANXX实体层次
//********************************************************************************//

#region Entity

using System;
using System.Data;
using Entity;
using Oracle.DataAccess.Client;
using Platform.Configuration;
using Platform.Data;

namespace Entity
{
    [Serializable]
    public class YS_LH_LAIHANXX
    {
        private decimal? m_dec_i_autotype;

        private decimal? m_dec_i_dangqianbzqr;

        private decimal? m_dec_i_fushen;

        private decimal? m_dec_i_fushenr;

        private decimal? m_dec_i_jlzt;

        private decimal? m_dec_i_laihanlx;

        private decimal? m_dec_i_liuchengbh;

        private decimal? m_dec_i_liuchengzt;

        private decimal? m_dec_i_m;

        private decimal? m_dec_i_shangchuan;

        private decimal? m_dec_i_shenpijg;

        private decimal? m_dec_i_shenpir;

        private decimal? m_dec_i_shurur;

        private decimal? m_dec_i_tzm;

        private decimal? m_dec_i_tzy;

        private decimal? m_dec_i_xianchuan;

        private decimal? m_dec_i_xt;

        private decimal? m_dec_i_y;

        private decimal? m_dec_i_ywy;

        private decimal m_dec_id;

        private DateTime? m_DT_d_caozuosj;

        private DateTime? m_DT_d_fushenrq;

        private DateTime? m_DT_d_laihanrq;

        private DateTime? m_DT_d_shenpirq;

        private DateTime? m_DT_d_shururq;

        private string m_str_s_beiyong1;

        private string m_str_s_beiyong2;

        private string m_str_s_beiyong3;

        private string m_str_s_beizhu;

        private string m_str_s_caozuor;

        private string m_str_s_fushenr;

        private string m_str_s_guanlikbh;

        private string m_str_s_laihanbh;

        private string m_str_s_miaoshu;

        private string m_str_s_shenpinr;

        private string m_str_s_shenpir;

        private string m_str_s_shenqingly;

        private string m_str_s_tongyibm;

        private string m_str_s_xukebh;

        private string m_str_s_yhywy;

        private string m_str_s_yonghubh;

        private string m_str_s_yonghum;

        private string m_str_s_ywy;

        private string m_str_s_ywyyj;

        private string m_str_s_zhandianbh;

        /// <summary>
        ///     站点编号
        /// </summary>
        public string S_ZHANDIANBH
        {
            get { return m_str_s_zhandianbh; }
            set { m_str_s_zhandianbh = value; }
        }

        /// <summary>
        ///     用户来函编号
        /// </summary>
        public string S_LAIHANBH
        {
            get { return m_str_s_laihanbh; }
            set { m_str_s_laihanbh = value; }
        }

        /// <summary>
        ///     来函日期
        /// </summary>
        public DateTime? D_LAIHANRQ
        {
            get { return m_DT_d_laihanrq; }
            set { m_DT_d_laihanrq = value; }
        }

        /// <summary>
        ///     输入日期
        /// </summary>
        public DateTime? D_SHURURQ
        {
            get { return m_DT_d_shururq; }
            set { m_DT_d_shururq = value; }
        }

        /// <summary>
        ///     年
        /// </summary>
        public decimal? I_Y
        {
            get { return m_dec_i_y; }
            set { m_dec_i_y = value; }
        }

        /// <summary>
        ///     月
        /// </summary>
        public decimal? I_M
        {
            get { return m_dec_i_m; }
            set { m_dec_i_m = value; }
        }

        /// <summary>
        ///     输入人
        /// </summary>
        public decimal? I_SHURUR
        {
            get { return m_dec_i_shurur; }
            set { m_dec_i_shurur = value; }
        }

        /// <summary>
        ///     来函类型
        /// </summary>
        public decimal? I_LAIHANLX
        {
            get { return m_dec_i_laihanlx; }
            set { m_dec_i_laihanlx = value; }
        }

        /// <summary>
        ///     用户编号
        /// </summary>
        public string S_YONGHUBH
        {
            get { return m_str_s_yonghubh; }
            set { m_str_s_yonghubh = value; }
        }

        /// <summary>
        ///     描述
        /// </summary>
        public string S_MIAOSHU
        {
            get { return m_str_s_miaoshu; }
            set { m_str_s_miaoshu = value; }
        }

        /// <summary>
        ///     记录状态
        /// </summary>
        public decimal? I_JLZT
        {
            get { return m_dec_i_jlzt; }
            set { m_dec_i_jlzt = value; }
        }

        /// <summary>
        ///     审批结果 1同意  0不同意
        /// </summary>
        public decimal? I_SHENPIJG
        {
            get { return m_dec_i_shenpijg; }
            set { m_dec_i_shenpijg = value; }
        }

        /// <summary>
        ///     审批日期
        /// </summary>
        public DateTime? D_SHENPIRQ
        {
            get { return m_DT_d_shenpirq; }
            set { m_DT_d_shenpirq = value; }
        }

        /// <summary>
        ///     对应i_autotype  可能是审批状态
        /// </summary>
        public decimal? I_AUTOTYPE
        {
            get { return m_dec_i_autotype; }
            set { m_dec_i_autotype = value; }
        }

        /// <summary>
        ///     上传标识
        /// </summary>
        public decimal? I_SHANGCHUAN
        {
            get { return m_dec_i_shangchuan; }
            set { m_dec_i_shangchuan = value; }
        }

        /// <summary>
        ///     下传标示
        /// </summary>
        public decimal? I_XIANCHUAN
        {
            get { return m_dec_i_xianchuan; }
            set { m_dec_i_xianchuan = value; }
        }

        /// <summary>
        ///     对应c_by1   许可编号
        /// </summary>
        public string S_BEIYONG1
        {
            get { return m_str_s_beiyong1; }
            set { m_str_s_beiyong1 = value; }
        }

        /// <summary>
        ///     备用2
        /// </summary>
        public string S_BEIYONG2
        {
            get { return m_str_s_beiyong2; }
            set { m_str_s_beiyong2 = value; }
        }

        /// <summary>
        ///     备用三
        /// </summary>
        public string S_BEIYONG3
        {
            get { return m_str_s_beiyong3; }
            set { m_str_s_beiyong3 = value; }
        }

        /// <summary>
        ///     统一审批编码
        /// </summary>
        public string S_TONGYIBM
        {
            get { return m_str_s_tongyibm; }
            set { m_str_s_tongyibm = value; }
        }

        /// <summary>
        ///     流程编号
        /// </summary>
        public decimal? I_LIUCHENGBH
        {
            get { return m_dec_i_liuchengbh; }
            set { m_dec_i_liuchengbh = value; }
        }

        /// <summary>
        ///     管理块编号
        /// </summary>
        public string S_GUANLIKBH
        {
            get { return m_str_s_guanlikbh; }
            set { m_str_s_guanlikbh = value; }
        }

        /// <summary>
        ///     最终审批人
        /// </summary>
        public decimal? I_SHENPIR
        {
            get { return m_dec_i_shenpir; }
            set { m_dec_i_shenpir = value; }
        }

        /// <summary>
        ///     主键
        /// </summary>
        public decimal ID
        {
            get { return m_dec_id; }
            set { m_dec_id = value; }
        }

        /// <summary>
        ///     许可受理编号
        /// </summary>
        public string S_XUKEBH
        {
            get { return m_str_s_xukebh; }
            set { m_str_s_xukebh = value; }
        }

        /// <summary>
        ///     操作人
        /// </summary>
        public string S_CAOZUOR
        {
            get { return m_str_s_caozuor; }
            set { m_str_s_caozuor = value; }
        }

        /// <summary>
        ///     操作时间
        /// </summary>
        public DateTime? D_CAOZUOSJ
        {
            get { return m_DT_d_caozuosj; }
            set { m_DT_d_caozuosj = value; }
        }

        /// <summary>
        ///     申请理由
        /// </summary>
        public string S_SHENQINGLY
        {
            get { return m_str_s_shenqingly; }
            set { m_str_s_shenqingly = value; }
        }

        /// <summary>
        ///     备注
        /// </summary>
        public string S_BEIZHU
        {
            get { return m_str_s_beizhu; }
            set { m_str_s_beizhu = value; }
        }

        /// <summary>
        ///     流程状态
        /// </summary>
        public decimal? I_LIUCHENGZT
        {
            get { return m_dec_i_liuchengzt; }
            set { m_dec_i_liuchengzt = value; }
        }

        /// <summary>
        ///     当前处理步骤确认状态 1已确认 0未确认
        /// </summary>
        public decimal? I_DANGQIANBZQR
        {
            get { return m_dec_i_dangqianbzqr; }
            set { m_dec_i_dangqianbzqr = value; }
        }

        /// <summary>
        ///     用户名
        /// </summary>
        public string S_YONGHUM
        {
            get { return m_str_s_yonghum; }
            set { m_str_s_yonghum = value; }
        }

        /// <summary>
        /// </summary>
        public string S_YHYWY
        {
            get { return m_str_s_yhywy; }
            set { m_str_s_yhywy = value; }
        }

        /// <summary>
        ///     0:自来水 1:地表水 2:地下水
        /// </summary>
        public decimal? I_XT
        {
            get { return m_dec_i_xt; }
            set { m_dec_i_xt = value; }
        }

        /// <summary>
        ///     审批内容
        /// </summary>
        public string S_SHENPINR
        {
            get { return m_str_s_shenpinr; }
            set { m_str_s_shenpinr = value; }
        }

        /// <summary>
        ///     用户业务员
        /// </summary>
        public decimal? I_YWY
        {
            get { return m_dec_i_ywy; }
            set { m_dec_i_ywy = value; }
        }

        /// <summary>
        ///     业务员意见
        /// </summary>
        public string S_YWYYJ
        {
            get { return m_str_s_ywyyj; }
            set { m_str_s_ywyyj = value; }
        }

        /// <summary>
        ///     业务员
        /// </summary>
        public string S_YWY
        {
            get { return m_str_s_ywy; }
            set { m_str_s_ywy = value; }
        }

        /// <summary>
        ///     复审状态 1:已复审
        /// </summary>
        public decimal? I_FUSHEN
        {
            get { return m_dec_i_fushen; }
            set { m_dec_i_fushen = value; }
        }

        /// <summary>
        /// </summary>
        public DateTime? D_FUSHENRQ
        {
            get { return m_DT_d_fushenrq; }
            set { m_DT_d_fushenrq = value; }
        }

        /// <summary>
        /// </summary>
        public string S_FUSHENR
        {
            get { return m_str_s_fushenr; }
            set { m_str_s_fushenr = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_FUSHENR
        {
            get { return m_dec_i_fushenr; }
            set { m_dec_i_fushenr = value; }
        }

        /// <summary>
        ///     最终审批人
        /// </summary>
        public string S_SHENPIR
        {
            get { return m_str_s_shenpir; }
            set { m_str_s_shenpir = value; }
        }

        /// <summary>
        ///     调整年
        /// </summary>
        public decimal? I_TZY
        {
            get { return m_dec_i_tzy; }
            set { m_dec_i_tzy = value; }
        }

        /// <summary>
        ///     调整月
        /// </summary>
        public decimal? I_TZM
        {
            get { return m_dec_i_tzm; }
            set { m_dec_i_tzm = value; }
        }
    }
}

#endregion

#region EntityProcess

namespace BLL.Access
{
    //using System.Data.OracleClient;

    public class YS_LH_LAIHANXXProcess
    {
        #region Field

        protected string conn;

        #endregion

        #region Construction

        public YS_LH_LAIHANXXProcess()
        {
            conn = ConfigHelper.PlatformConnString;
        }

        #endregion

        #region public

        /// <summary>
        ///     根据YS_LH_LAIHANXX实体添加或者修改YS_LH_LAIHANXX信息
        /// </summary>
        public bool InsertOrUpdate(YS_LH_LAIHANXX YS_LH_LAIHANXX, OracleTransaction Transaction)
        {
            if (YS_LH_LAIHANXX.ID == 0)
                InsertYS_LH_LAIHANXX(YS_LH_LAIHANXX, Transaction);
            else
                UpdateYS_LH_LAIHANXX(YS_LH_LAIHANXX, Transaction);
            return YS_LH_LAIHANXX.ID == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_LH_LAIHANXX实体添加或修改YS_LH_LAIHANXX信息
        /// </summary>
        public bool InsertOrUpdate(YS_LH_LAIHANXX YS_LH_LAIHANXX)
        {
            return InsertOrUpdate(YS_LH_LAIHANXX, null);
        }


        /// <summary>
        ///     根据YS_LH_LAIHANXX主键删除YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_LH_LAIHANXX(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_LH_LAIHANXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_LH_LAIHANXX主键删除YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_LH_LAIHANXX(decimal ID)
        {
            return DeleteYS_LH_LAIHANXX(ID, null);
        }

        /// <summary>
        ///     根据条件删除YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_LH_LAIHANXXesDynamic(string WhereClause, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_LH_LAIHANXXesDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = WhereClause;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据条件删除YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_LH_LAIHANXXesDynamic(string WhereClause)
        {
            return DeleteYS_LH_LAIHANXXesDynamic(WhereClause, null);
        }

        /// <summary>
        ///     根据YS_LH_LAIHANXX主键选择YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_LH_LAIHANXX信息</returns>
        public YS_LH_LAIHANXX SelectYS_LH_LAIHANXX(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_LAIHANXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            OracleDataReader rd;
            if (Transaction == null)
                rd = OracleHelper.ExecuteReader(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                rd = OracleHelper.ExecuteReader(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (rd.Read())
            {
                var YS_LH_LAIHANXX = PopulateYS_LH_LAIHANXX(rd);
                rd.Close();
                return YS_LH_LAIHANXX;
            }
            return null;
        }

        /// <summary>
        ///     根据YS_LH_LAIHANXX主键选择YS_LH_LAIHANXX信息
        /// </summary>
        /// <returns>YS_LH_LAIHANXX信息</returns>
        public YS_LH_LAIHANXX SelectYS_LH_LAIHANXX(decimal ID)
        {
            return SelectYS_LH_LAIHANXX(ID, null);
        }

        /// <summary>
        ///     选择所有YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>所有YS_LH_LAIHANXX信息</returns>
        public DataTable SelectYS_LH_LAIHANXXesAll(OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_LAIHANXXesAll";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }

        /// <summary>
        ///     选择所有YS_LH_LAIHANXX信息
        /// </summary>
        /// <returns>所有YS_LH_LAIHANXX信息</returns>
        public DataTable SelectYS_LH_LAIHANXXesAll()
        {
            return SelectYS_LH_LAIHANXXesAll(null);
        }

        /// <summary>
        ///     根据条件选择YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_LH_LAIHANXX信息</returns>
        public DataTable SelectYS_LH_LAIHANXXesDynamic(string WhereClause, string OrderByExpression,
            OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_LAIHANXXesDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <returns>YS_LH_LAIHANXX信息</returns>
        public DataTable SelectYS_LH_LAIHANXXesDynamic(string WhereClause, string OrderByExpression)
        {
            return SelectYS_LH_LAIHANXXesDynamic(WhereClause, OrderByExpression, null);
        }


        /// <summary>
        ///     根据条件选择YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_LH_LAIHANXX信息</returns>
        public DataTable SelectYS_LH_LAIHANXXesDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_LAIHANXXesDynPaged";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            storedParams[2].Value = PageIndex;
            storedParams[3].Value = PageSize;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_LH_LAIHANXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <returns>YS_LH_LAIHANXX信息</returns>
        public DataTable SelectYS_LH_LAIHANXXesDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize)
        {
            return SelectYS_LH_LAIHANXXesDynamic(WhereClause, OrderByExpression, PageIndex, PageSize, null);
        }

        /// <summary>
        ///     根据条件更新YS_LH_LAIHANXX字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_LH_LAIHANXXesDynamic(string UpdateValue, string WhereClause, OracleTransaction Transaction)
        {
            var result = 0;
            if (UpdateValue == "" || WhereClause == "")
                return 0;
            var spName = "CS_UpdYS_LH_LAIHANXXDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            storedParams[0].Value = UpdateValue;
            storedParams[1].Value = WhereClause;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            result = Convert.ToInt32(storedParams[2].Value);
            return result;
        }

        /// <summary>
        ///     根据条件更新YS_LH_LAIHANXX字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_LH_LAIHANXXesDynamic(string UpdateValue, string WhereClause)
        {
            return UpdateYS_LH_LAIHANXXesDynamic(UpdateValue, WhereClause, null);
        }

        #endregion

        #region Private

        private int InsertYS_LH_LAIHANXX(YS_LH_LAIHANXX YS_LH_LAIHANXX, OracleTransaction Transaction)
        {
            var spName = "CS_InsYS_LH_LAIHANXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_LH_LAIHANXX.S_ZHANDIANBH;
            storedParams[1].Value = YS_LH_LAIHANXX.S_LAIHANBH;
            storedParams[2].Value = YS_LH_LAIHANXX.D_LAIHANRQ;
            storedParams[3].Value = YS_LH_LAIHANXX.D_SHURURQ;
            storedParams[4].Value = YS_LH_LAIHANXX.I_Y;
            storedParams[5].Value = YS_LH_LAIHANXX.I_M;
            storedParams[6].Value = YS_LH_LAIHANXX.I_SHURUR;
            storedParams[7].Value = YS_LH_LAIHANXX.I_LAIHANLX;
            storedParams[8].Value = YS_LH_LAIHANXX.S_YONGHUBH;
            storedParams[9].Value = YS_LH_LAIHANXX.S_MIAOSHU;
            storedParams[10].Value = YS_LH_LAIHANXX.I_JLZT;
            storedParams[11].Value = YS_LH_LAIHANXX.I_SHENPIJG;
            storedParams[12].Value = YS_LH_LAIHANXX.D_SHENPIRQ;
            storedParams[13].Value = YS_LH_LAIHANXX.I_AUTOTYPE;
            storedParams[14].Value = YS_LH_LAIHANXX.I_SHANGCHUAN;
            storedParams[15].Value = YS_LH_LAIHANXX.I_XIANCHUAN;
            storedParams[16].Value = YS_LH_LAIHANXX.S_BEIYONG1;
            storedParams[17].Value = YS_LH_LAIHANXX.S_BEIYONG2;
            storedParams[18].Value = YS_LH_LAIHANXX.S_BEIYONG3;
            storedParams[19].Value = YS_LH_LAIHANXX.S_TONGYIBM;
            storedParams[20].Value = YS_LH_LAIHANXX.I_LIUCHENGBH;
            storedParams[21].Value = YS_LH_LAIHANXX.S_GUANLIKBH;
            storedParams[22].Value = YS_LH_LAIHANXX.I_SHENPIR;
            storedParams[23].Value = YS_LH_LAIHANXX.S_XUKEBH;
            storedParams[24].Value = YS_LH_LAIHANXX.S_CAOZUOR;
            storedParams[25].Value = YS_LH_LAIHANXX.D_CAOZUOSJ;
            storedParams[26].Value = YS_LH_LAIHANXX.S_SHENQINGLY;
            storedParams[27].Value = YS_LH_LAIHANXX.S_BEIZHU;
            storedParams[28].Value = YS_LH_LAIHANXX.I_LIUCHENGZT;
            storedParams[29].Value = YS_LH_LAIHANXX.I_DANGQIANBZQR;
            storedParams[30].Value = YS_LH_LAIHANXX.S_YONGHUM;
            storedParams[31].Value = YS_LH_LAIHANXX.S_YHYWY;
            storedParams[32].Value = YS_LH_LAIHANXX.I_XT;
            storedParams[33].Value = YS_LH_LAIHANXX.S_SHENPINR;
            storedParams[34].Value = YS_LH_LAIHANXX.I_YWY;
            storedParams[35].Value = YS_LH_LAIHANXX.S_YWYYJ;
            storedParams[36].Value = YS_LH_LAIHANXX.S_YWY;
            storedParams[37].Value = YS_LH_LAIHANXX.I_FUSHEN;
            storedParams[38].Value = YS_LH_LAIHANXX.D_FUSHENRQ;
            storedParams[39].Value = YS_LH_LAIHANXX.S_FUSHENR;
            storedParams[40].Value = YS_LH_LAIHANXX.I_FUSHENR;
            storedParams[41].Value = YS_LH_LAIHANXX.S_SHENPIR;
            storedParams[42].Value = YS_LH_LAIHANXX.I_TZY;
            storedParams[43].Value = YS_LH_LAIHANXX.I_TZM;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            YS_LH_LAIHANXX.ID = Convert.ToInt32(storedParams[44].Value);
            return result;
        }

        private bool UpdateYS_LH_LAIHANXX(YS_LH_LAIHANXX YS_LH_LAIHANXX, OracleTransaction Transaction)
        {
            var spName = "CS_UpdYS_LH_LAIHANXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_LH_LAIHANXX.S_ZHANDIANBH;
            storedParams[1].Value = YS_LH_LAIHANXX.S_LAIHANBH;
            storedParams[2].Value = YS_LH_LAIHANXX.D_LAIHANRQ;
            storedParams[3].Value = YS_LH_LAIHANXX.D_SHURURQ;
            storedParams[4].Value = YS_LH_LAIHANXX.I_Y;
            storedParams[5].Value = YS_LH_LAIHANXX.I_M;
            storedParams[6].Value = YS_LH_LAIHANXX.I_SHURUR;
            storedParams[7].Value = YS_LH_LAIHANXX.I_LAIHANLX;
            storedParams[8].Value = YS_LH_LAIHANXX.S_YONGHUBH;
            storedParams[9].Value = YS_LH_LAIHANXX.S_MIAOSHU;
            storedParams[10].Value = YS_LH_LAIHANXX.I_JLZT;
            storedParams[11].Value = YS_LH_LAIHANXX.I_SHENPIJG;
            storedParams[12].Value = YS_LH_LAIHANXX.D_SHENPIRQ;
            storedParams[13].Value = YS_LH_LAIHANXX.I_AUTOTYPE;
            storedParams[14].Value = YS_LH_LAIHANXX.I_SHANGCHUAN;
            storedParams[15].Value = YS_LH_LAIHANXX.I_XIANCHUAN;
            storedParams[16].Value = YS_LH_LAIHANXX.S_BEIYONG1;
            storedParams[17].Value = YS_LH_LAIHANXX.S_BEIYONG2;
            storedParams[18].Value = YS_LH_LAIHANXX.S_BEIYONG3;
            storedParams[19].Value = YS_LH_LAIHANXX.S_TONGYIBM;
            storedParams[20].Value = YS_LH_LAIHANXX.I_LIUCHENGBH;
            storedParams[21].Value = YS_LH_LAIHANXX.S_GUANLIKBH;
            storedParams[22].Value = YS_LH_LAIHANXX.I_SHENPIR;
            storedParams[23].Value = YS_LH_LAIHANXX.S_XUKEBH;
            storedParams[24].Value = YS_LH_LAIHANXX.S_CAOZUOR;
            storedParams[25].Value = YS_LH_LAIHANXX.D_CAOZUOSJ;
            storedParams[26].Value = YS_LH_LAIHANXX.S_SHENQINGLY;
            storedParams[27].Value = YS_LH_LAIHANXX.S_BEIZHU;
            storedParams[28].Value = YS_LH_LAIHANXX.I_LIUCHENGZT;
            storedParams[29].Value = YS_LH_LAIHANXX.I_DANGQIANBZQR;
            storedParams[30].Value = YS_LH_LAIHANXX.S_YONGHUM;
            storedParams[31].Value = YS_LH_LAIHANXX.S_YHYWY;
            storedParams[32].Value = YS_LH_LAIHANXX.I_XT;
            storedParams[33].Value = YS_LH_LAIHANXX.S_SHENPINR;
            storedParams[34].Value = YS_LH_LAIHANXX.I_YWY;
            storedParams[35].Value = YS_LH_LAIHANXX.S_YWYYJ;
            storedParams[36].Value = YS_LH_LAIHANXX.S_YWY;
            storedParams[37].Value = YS_LH_LAIHANXX.I_FUSHEN;
            storedParams[38].Value = YS_LH_LAIHANXX.D_FUSHENRQ;
            storedParams[39].Value = YS_LH_LAIHANXX.S_FUSHENR;
            storedParams[40].Value = YS_LH_LAIHANXX.I_FUSHENR;
            storedParams[41].Value = YS_LH_LAIHANXX.S_SHENPIR;
            storedParams[42].Value = YS_LH_LAIHANXX.I_TZY;
            storedParams[43].Value = YS_LH_LAIHANXX.I_TZM;
            storedParams[44].Value = YS_LH_LAIHANXX.ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }


        private YS_LH_LAIHANXX PopulateYS_LH_LAIHANXX(IDataReader dr)
        {
            var YS_LH_LAIHANXX = new YS_LH_LAIHANXX();
            YS_LH_LAIHANXX.S_ZHANDIANBH = dr["S_ZHANDIANBH"] == DBNull.Value ? null : (string) dr["S_ZHANDIANBH"];
            YS_LH_LAIHANXX.S_LAIHANBH = dr["S_LAIHANBH"] == DBNull.Value ? null : (string) dr["S_LAIHANBH"];
            YS_LH_LAIHANXX.D_LAIHANRQ = dr["D_LAIHANRQ"] == DBNull.Value ? null : (DateTime?) dr["D_LAIHANRQ"];
            YS_LH_LAIHANXX.D_SHURURQ = dr["D_SHURURQ"] == DBNull.Value ? null : (DateTime?) dr["D_SHURURQ"];
            YS_LH_LAIHANXX.I_Y = dr["I_Y"] == DBNull.Value ? null : (decimal?) dr["I_Y"];
            YS_LH_LAIHANXX.I_M = dr["I_M"] == DBNull.Value ? null : (decimal?) dr["I_M"];
            YS_LH_LAIHANXX.I_SHURUR = dr["I_SHURUR"] == DBNull.Value ? null : (decimal?) dr["I_SHURUR"];
            YS_LH_LAIHANXX.I_LAIHANLX = dr["I_LAIHANLX"] == DBNull.Value ? null : (decimal?) dr["I_LAIHANLX"];
            YS_LH_LAIHANXX.S_YONGHUBH = dr["S_YONGHUBH"] == DBNull.Value ? null : (string) dr["S_YONGHUBH"];
            YS_LH_LAIHANXX.S_MIAOSHU = dr["S_MIAOSHU"] == DBNull.Value ? null : (string) dr["S_MIAOSHU"];
            YS_LH_LAIHANXX.I_JLZT = dr["I_JLZT"] == DBNull.Value ? null : (decimal?) dr["I_JLZT"];
            YS_LH_LAIHANXX.I_SHENPIJG = dr["I_SHENPIJG"] == DBNull.Value ? null : (decimal?) dr["I_SHENPIJG"];
            YS_LH_LAIHANXX.D_SHENPIRQ = dr["D_SHENPIRQ"] == DBNull.Value ? null : (DateTime?) dr["D_SHENPIRQ"];
            YS_LH_LAIHANXX.I_AUTOTYPE = dr["I_AUTOTYPE"] == DBNull.Value ? null : (decimal?) dr["I_AUTOTYPE"];
            YS_LH_LAIHANXX.I_SHANGCHUAN = dr["I_SHANGCHUAN"] == DBNull.Value ? null : (decimal?) dr["I_SHANGCHUAN"];
            YS_LH_LAIHANXX.I_XIANCHUAN = dr["I_XIANCHUAN"] == DBNull.Value ? null : (decimal?) dr["I_XIANCHUAN"];
            YS_LH_LAIHANXX.S_BEIYONG1 = dr["S_BEIYONG1"] == DBNull.Value ? null : (string) dr["S_BEIYONG1"];
            YS_LH_LAIHANXX.S_BEIYONG2 = dr["S_BEIYONG2"] == DBNull.Value ? null : (string) dr["S_BEIYONG2"];
            YS_LH_LAIHANXX.S_BEIYONG3 = dr["S_BEIYONG3"] == DBNull.Value ? null : (string) dr["S_BEIYONG3"];
            YS_LH_LAIHANXX.S_TONGYIBM = dr["S_TONGYIBM"] == DBNull.Value ? null : (string) dr["S_TONGYIBM"];
            YS_LH_LAIHANXX.I_LIUCHENGBH = dr["I_LIUCHENGBH"] == DBNull.Value ? null : (decimal?) dr["I_LIUCHENGBH"];
            YS_LH_LAIHANXX.S_GUANLIKBH = dr["S_GUANLIKBH"] == DBNull.Value ? null : (string) dr["S_GUANLIKBH"];
            YS_LH_LAIHANXX.I_SHENPIR = dr["I_SHENPIR"] == DBNull.Value ? null : (decimal?) dr["I_SHENPIR"];
            YS_LH_LAIHANXX.ID = dr["ID"] == DBNull.Value ? 0 : (decimal) dr["ID"];
            YS_LH_LAIHANXX.S_XUKEBH = dr["S_XUKEBH"] == DBNull.Value ? null : (string) dr["S_XUKEBH"];
            YS_LH_LAIHANXX.S_CAOZUOR = dr["S_CAOZUOR"] == DBNull.Value ? null : (string) dr["S_CAOZUOR"];
            YS_LH_LAIHANXX.D_CAOZUOSJ = dr["D_CAOZUOSJ"] == DBNull.Value ? null : (DateTime?) dr["D_CAOZUOSJ"];
            YS_LH_LAIHANXX.S_SHENQINGLY = dr["S_SHENQINGLY"] == DBNull.Value ? null : (string) dr["S_SHENQINGLY"];
            YS_LH_LAIHANXX.S_BEIZHU = dr["S_BEIZHU"] == DBNull.Value ? null : (string) dr["S_BEIZHU"];
            YS_LH_LAIHANXX.I_LIUCHENGZT = dr["I_LIUCHENGZT"] == DBNull.Value ? null : (decimal?) dr["I_LIUCHENGZT"];
            YS_LH_LAIHANXX.I_DANGQIANBZQR =
                dr["I_DANGQIANBZQR"] == DBNull.Value ? null : (decimal?) dr["I_DANGQIANBZQR"];
            YS_LH_LAIHANXX.S_YONGHUM = dr["S_YONGHUM"] == DBNull.Value ? null : (string) dr["S_YONGHUM"];
            YS_LH_LAIHANXX.S_YHYWY = dr["S_YHYWY"] == DBNull.Value ? null : (string) dr["S_YHYWY"];
            YS_LH_LAIHANXX.I_XT = dr["I_XT"] == DBNull.Value ? null : (decimal?) dr["I_XT"];
            YS_LH_LAIHANXX.S_SHENPINR = dr["S_SHENPINR"] == DBNull.Value ? null : (string) dr["S_SHENPINR"];
            YS_LH_LAIHANXX.I_YWY = dr["I_YWY"] == DBNull.Value ? null : (decimal?) dr["I_YWY"];
            YS_LH_LAIHANXX.S_YWYYJ = dr["S_YWYYJ"] == DBNull.Value ? null : (string) dr["S_YWYYJ"];
            YS_LH_LAIHANXX.S_YWY = dr["S_YWY"] == DBNull.Value ? null : (string) dr["S_YWY"];
            YS_LH_LAIHANXX.I_FUSHEN = dr["I_FUSHEN"] == DBNull.Value ? null : (decimal?) dr["I_FUSHEN"];
            YS_LH_LAIHANXX.D_FUSHENRQ = dr["D_FUSHENRQ"] == DBNull.Value ? null : (DateTime?) dr["D_FUSHENRQ"];
            YS_LH_LAIHANXX.S_FUSHENR = dr["S_FUSHENR"] == DBNull.Value ? null : (string) dr["S_FUSHENR"];
            YS_LH_LAIHANXX.I_FUSHENR = dr["I_FUSHENR"] == DBNull.Value ? null : (decimal?) dr["I_FUSHENR"];
            YS_LH_LAIHANXX.S_SHENPIR = dr["S_SHENPIR"] == DBNull.Value ? null : (string) dr["S_SHENPIR"];
            YS_LH_LAIHANXX.I_TZY = dr["I_TZY"] == DBNull.Value ? null : (decimal?) dr["I_TZY"];
            YS_LH_LAIHANXX.I_TZM = dr["I_TZM"] == DBNull.Value ? null : (decimal?) dr["I_TZM"];
            return YS_LH_LAIHANXX;
        }


        private void AddRowNumber(DataTable dt)
        {
            dt.Columns.Add(new DataColumn("RowNumber", typeof(int)));
            for (var i = 0; i < dt.Rows.Count; i++)
                dt.Rows[i][dt.Columns.Count - 1] = i + 1;
        }

        #endregion
    }
}

#endregion